//
//  CommissionTableViewCell.m
//  Kfangchan
//
//  Created by liran on 14/11/7.
//  Copyright (c) 2014年 Beijing Renjuren Network Technology Co., Ltd. All rights reserved.
//

#import "CommissionTableViewCell.h"

@interface CommissionTableViewCell()

@property (strong, nonatomic) Commission *commission;

@property (strong, nonatomic) IBOutlet UILabel *moneyLabel;
@property (strong, nonatomic) IBOutlet UILabel *descrLabel;
@property (strong, nonatomic) IBOutlet UILabel *payDateLabel;
@property (strong, nonatomic) IBOutlet UIView *payView;

@property (strong, nonatomic) IBOutlet UILabel *typeLabel;
@property (strong, nonatomic) IBOutlet UILabel *remarkLabel;

@end

@implementation CommissionTableViewCell

- (void)awakeFromNib {
    UIImageView *line = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"partition.png"]];
    line.frame = CGRectMake(0, 62, 320, 0.5);
    [self.contentView addSubview:line];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

#pragma mark -
#pragma mark 封装cell
- (void)initCell:(Commission *)entity {
    self.commission = entity;
    
    self.moneyLabel.text = [NSString stringWithFormat:@"￥%.2f", self.commission.money];
    self.descrLabel.text = [NSString stringWithFormat:@"%@", self.commission.descr];
    
    if (self.commission.status == 0) {
        if (self.commission.type == 2) {
            self.typeLabel.text = @"佣金";
        }
        self.payView.frame = self.contentView.bounds;
        self.remarkLabel.text = entity.remark;
    } else {
        self.payDateLabel.text = self.commission.payDate;
    }
}

@end
